<?php
/**
 * True Gallery back-end pictures filter template file
 *
 * @version 2.5
 * @author Alexey N. Brin (userxp@joomlaportal.ru)
 * @homepage http://truegallery.ru 
 * @filename admin.pictures.filter.tpl.php
 * @package True Gallery
 * @copyright (C) 2008-2009 by joomlatune.ru
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 * 
 * THIS GALLERY is an EVOLUTION of AkoGallery -> PonyGallery -> DatsoGallery
 *
 * If you fork this to create your own project, 
 * please make a reference to True Gallery someplace in your code 
 * and provide a link to http://www.joomlatune.ru
 *
 **/

defined('_VALID_MOS') or defined('_JEXEC') or die('Direct Access to this location is not allowed.');


// disabled="disabled"
function getSelectCondList($id='', $full=true) {
	$result = '
	<select onchange="javascript:groupselectchange(this)" '.(!$full ? '':'').' id="'.$id.'" name="'.$id.'">'.
		'<option value="" '.($full ? '':'selected="selected"').'></option>'.
		($full ? '<option value="=" selected="selected">=</option>' :'').
		'<option value="&lt;&gt;">&lt;&gt;</option>'.
		'<option value="&lt;">&lt;</option>'.
		'<option value="&gt">&gt;</option>'.
		'<option value="&lt;=">&lt;=</option>'.
		'<option value="&gt;=">&gt;=</option>'.
	'</select>';
	return $result;
}


// to call use link: TRUE_INDEX2.'& view=pictures & task=showfilter & ax=1 & no_html=1
?>
<style>
#picture_sizes {
	padding: 10px;
}
</style>
<form action="<?php echo TRUE_INDEX2; ?>&view=pictures&task=show" method="post" name="adminFilterForm" id="adminFilterForm">
	<div id="tg_pictures_filter">
	<?php ob_start(); ?>
		<div id="picture_sizes">
			<table class="adminlist">
				<tr>
					<th class="tg_adminheader" colspan="2"><?php echo JText::_('Filter'); ?></th>
				</tr>
				<tr>
					<th><label for="Name"><?php echo JText::_('Name'); ?></label></th>
					<td><input name="filter[imgtitle]" size="50" value="" /></td>
				</tr>
				<tr>
					<th><label for="__catlist"><?php echo JText::_('Categories'); ?></label></th>
					<td>
						<?php echo $clist['catgs']; ?>
						<!--select name="__catlist" id="__catlist" ></select-->
					</td>
				</tr>
				<tr>
					<th><label for="author"><?php echo JText::_('Author'); ?></label></th>
					<td><input name="filter[imgauthor]" size="50" value="" /></td>
				</tr>
				<tr>
					<th><label for="published"><?php echo JText::_('Published'); ?></label></th>
					<td><input type="radio" name="filter[published]" value="0" checked="checked"/><?php echo JText::_('DO NOT USE'); ?>
						<input type="radio" name="filter[published]" value="1" /><?php echo JText::_('No'); ?>
						<input type="radio" name="filter[published]" value="2" /><?php echo JText::_('Yes'); ?>
					</td>
				</tr>
				<tr>
					<th><label for="approved"><?php echo JText::_('Approved'); ?></label></th>
					<td>
						<input type="radio" name="filter[approved]" value="0" checked="checked"/><?php echo JText::_('DO NOT USE'); ?>
						<input type="radio" name="filter[approved]" value="1" /><?php echo JText::_('No'); ?>
						<input type="radio" name="filter[approved]" value="2" /><?php echo JText::_('Yes'); ?>
					</td>
				</tr>
				<tr>
					<th><label for="orientation"><?php echo JText::_('Orientation'); ?></label></th>
					<td>
						<input type="radio" name="filter[orient]" value="0" checked="checked"/><?php echo JText::_('DO NOT USE'); ?>
						<input type="radio" name="filter[orient]" value="1" /><?php echo JText::_('Horisontal'); ?>
						<input type="radio" name="filter[orient]" value="2" /><?php echo JText::_('Vertical'); ?>
					</td>
				</tr>
			</table>
			<br />
			<br />
			<table>
				<tr>
					<td>
						<input name="filter[width_from]" value="" />
						<?php echo getSelectCondList('filter[width_from_sign]',0); ?>
					</td>
					<th align="center"><label for="width_from"><?php echo JText::_('width'); ?></label></th>
					<td>
						<?php echo getSelectCondList('filter[width_and_sign]'); ?>
						<input name="filter[width_and]" value="" />
					</td>
				</tr>
				<tr>
					<td>
						<input name="filter[height_from]" value="" />
						<?php echo getSelectCondList('filter[height_from_sign]',0); ?>
					</td>
					<th align="center"><label for="height_from"><?php echo JText::_('height'); ?></label></th>
					<td>
						<?php echo getSelectCondList('filter[height_and_sign]'); ?>
						<input name="filter[height_and]" value="" />
					</td>
				</tr>
				<tr>
					<td>
						<input name="filter[date_from]" value="" />
						<?php echo getSelectCondList('filter[date_from_sign]',0); ?>
					</td>
					<th align="center"><label for="date_from"><?php echo JText::_('date'); ?></label></th>
					<td>
						<?php echo getSelectCondList('filter[date_and_sign]'); ?>
						<input name="filter[date_and]" value="" />
					</td>
				</tr>
			</table>
			
			<br />
			<br />
			<div class="button2-left">
				<div class="end">
					<a id="fancybox-apply-filter" href="#" onclick="javascript:applyfilter();"><?php echo JText::_('TG_APPLY_FILTER'); ?></a>
				</div>
				&nbsp;&nbsp;
				<div class="end">
					<a id="fancybox-reset-filter" href="#" onclick="javascript:clearfilter();"><?php echo JText::_('TG_CLEAR_FILTER'); ?></a>
				</div>
			</div>
		</div>
		<?php $c = ob_get_contents(); ob_end_clean(); echo getRoundedTab( $c ); ?>
	</div>
</form>

<script>
function applyfilter() {
	document.adminFilterForm.submit();
}

function clearfilter() {
	alert( 'TO DO\n[admin.pictures.filter.tpl.php]' );
	var filter = document.getElementsByName('filter');
	console.log( filter );
	//document.adminFilterForm.submit();
}

function groupselectchange(selector) {

}
</script>